﻿using QFramework;

namespace HKTools
{
    /// <summary>
    /// 改变观察视角的指令
    /// </summary>
    public class CMD_ChangeViewMode : AbstractCommand
    {
        public CMD_ChangeViewMode(ViewMode viewMode, HK_Point point = null)
        {
            this.viewMode = viewMode;

            if (point != null)
                this.point = point;
        }

        ViewMode viewMode;
        HK_Point point;

        protected override void OnExecute()
        {
            IHK_RoamingCamSystem roamingCamSystem = this.GetSystem<IHK_RoamingCamSystem>();

            if (viewMode == roamingCamSystem.CurViewMode.Value)
                return;

            if (!roamingCamSystem.IsCanRotCam.Value)
                return;

            roamingCamSystem.ChangeViewMode(viewMode, point);
        }
    }
}